'use strict';

/**
 * @ngdoc filter
 * @name App.filter:filters
 * @function
 * @description
 * # filters
 * Filter in the App.
 */
angular.module('App')
/**
 * 订单状态过滤器
 */
  .filter('tradeState', ['$sce', function($sce) {
    return function(orderStatus) {
      switch (orderStatus) {
        case 1:
          return $sce.trustAsHtml('<span class="label label-success">已支付</span>');
        case 2:
          return $sce.trustAsHtml('<span class="label label-info">未支付</span>');
        case 3:
          return $sce.trustAsHtml('<span class="label label-warning">已关闭</span>');
        case 4:
          return $sce.trustAsHtml('<span class="label label-navy">已撤销</span>');
        case 5:
          return $sce.trustAsHtml('<span class="label label-danger">已退款</span>');
      }
    };
  }])

/**
 * 支付方式过滤器
 */
  .filter('tradeType',['$sce',function($sce) {
    return function(payType) {
      switch(payType) {
        case 1:
          return $sce.trustAsHtml('<label class="label label-maroon">余额支付</label>');
          break;
        case 2:
          return $sce.trustAsHtml('<label class="label label-olive">微信支付</label>');
          break;
      }
    };
  }]);
